/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package taikai.draws;

import java.io.Serializable;
import taikai.TeamsOrPlayers;
import taikai.TeamOrPlayerForARound;
import taikai.MatchesData;

public class RoundRobinDrawStrategy implements DrawStrategy, Serializable {

    private TeamsOrPlayers teamsOrPlayers;

    RoundRobinDrawStrategy(TeamsOrPlayers teamsOrPlayers) {
        this.teamsOrPlayers = teamsOrPlayers;
    }

    @Override
    public String getName() {
        return "Round Robin";
    }

    @Override
    public String getEstimatedRunningTime() {
        return "";
    }

    @Override
    public void generateMatches(MatchesData matches) {
        for (int i = 0; i < teamsOrPlayers.getSize(); i++) {
            for (int j = i; j < teamsOrPlayers.getSize(); j++) {
                if (i != j) {
                    matches.add(new TeamOrPlayerForARound(teamsOrPlayers.getTeamOrPlayer(i), teamsOrPlayers.getTeamOrPlayer(j)));
                }
            }
        }
    }

    @Override
    public void setMatchLength(int matchLength) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void setChangeOverTime(int changeOverTime) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public int getMatchLength() {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public int getChangeOverTime() {
        throw new UnsupportedOperationException("Not supported yet.");
    }

}
